<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">

		<title>美容申请</title>

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">

		<link rel="stylesheet" type="text/css" href="css/themes/default/easyui.css">
		<link rel="stylesheet" type="text/css" href="css/themes/icon.css">
		<link rel="stylesheet" type="text/css" href="js/demo.css">
		<script type="text/javascript" src="js/jquery-1.8.0.min.js"></script>
		<script type="text/javascript" src="js/jquery.easyui.min.js"></script>
		<link rel="stylesheet" type="text/css" href="css/usedcar.css">
		<style type="text/css">
		#main {
			width: 100%;
		}
		</style>
	<script type="text/javascript">
			function init(){
    			if("${message}"!=""){
					alert("${message}");
				}
    		}
		</script>
	</head>
  <body  onload="init();">
<div id="main">
	<table id="dg" title="保险单信息" class="easyui-datagrid" style="width:900px;height:500px"  
            toolbar="#toolbar" pagination="true"
            rownumbers="true" fitColumns="true" singleSelect="true">   
    </table>  
    <div id="toolbar">  
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="newUser()">新建</a>  
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="editUser()">编辑</a>  
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="destroyUser()">删除</a>  
    </div>  
      
    <div id="dlg" class="easyui-dialog" style="width:400px;height:350px;padding:10px 20px"  
            closed="true" buttons="#dlg-buttons">  
        <form id="fm" method="post">  
            <table>  
                <tr>  
                    <td>预约单号:</td>  
                    <td><input class="easyui-validatebox" type="text" id="oddId" name="oddId" readonly="readonly"></input></td>  
                </tr>  
                <tr>  
                    <td>创建日期:</td>  
                    <td><input class="easyui-validatebox" type="text" id="createDate" name="createDate" readonly="readonly"></input></td>  
                </tr>  
            </table>  
        </form>  
    </div>  
    <div id="dlg-buttons">  
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onclick="saveUser()">Save</a>  
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlg').dialog('close')">Cancel</a>  
    </div>  
    <script type="text/javascript">  
 		$('#dg').datagrid({ 
			remoteSort : false,
			pageSize: 10,  	
			pageList: [10, 15, 20, 30, 50],
			loadFilter: pagerFilter,
			columns:[[  
			          {field:'idInsurance',title:'状态'} 
			]],
 			loader: function(param, success, error) {
	 			success(${allinsurance});
	 		}
 		}); 
 		$('#dg').datagrid('selectRow',3);
 		function pagerFilter(data){
			if ($.isArray(data)){	// is array
					data = {
						total: data.length,
						rows: data
					}
			}
			var dg = $('#dg');
			var opts = dg.datagrid('options');
			var pager = dg.datagrid('getPager');
			pager.pagination({
				onSelectPage:function(pageNum, pageSize){
					opts.pageNumber = pageNum;
					opts.pageSize = pageSize;
					pager.pagination('refresh',{
						pageNumber:pageNum,
						pageSize:pageSize
					});
					dg.datagrid('loadData',data);
				},
				onRefresh:function(pageNumber, pageSize){
					dg.datagrid('reload');
				}
			});
			if (!data.originalRows){
				data.originalRows = (data.rows);
			}
			var start = (opts.pageNumber-1)*parseInt(opts.pageSize);
			var end = start + parseInt(opts.pageSize);
			data.rows = (data.originalRows.slice(start, end));
			return data;
		}
        function formatDate(str){
			var m = str.month+1;
			var d = str.date;
        	return (str.year+1900)+"-"+(m<10?('0'+m):m)+"-"+(d<10?('0'+d):d);
        }  
        function destroyUser(){  
            var row = $('#dg').datagrid('getSelected');  
            if (row){  
                $.messager.confirm('提示','确定删除这条记录吗?',function(r){  
                    if (r){
                      	window.location = 'cosmetology/carCosmetologyAction_destroyApply?id='+row.oddId;
                    }  
                });  
            }  
        }  
    </script>  
    <style type="text/css">  
        #fm{  
            margin:0;  
            padding:10px 30px;  
        }  
        .ftitle{  
            font-size:14px;  
            font-weight:bold;  
            padding:5px 0;  
            margin-bottom:10px;  
            border-bottom:1px solid #ccc;  
        }  
        .fitem{  
            margin-bottom:5px;  
        }  
        .fitem label{  
            display:inline-block;  
            width:80px;  
        }
    </style>
</div>


  </body>
</html>
